package com.ncloud.msg.scheduler;

import com.ncloud.msg.business.EmailBusi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Created by shiqiang on 2017/5/15.
 */
@Component
public class Scheduler {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private EmailBusi emailBusi;
    @Scheduled(cron="0 0/5 * * * ?") //每分钟执行一次
    public void statusCheck() {
        logger.debug("每5分钟执行一次。开始……");
        emailBusi.moveEmailToHis();
        logger.debug("每5分钟执行一次。结束。");
    }

    @Scheduled(fixedRate=2000)
    public void testTasks() {
        logger.debug("每2秒执行一次。开始……");
        emailBusi.SendMail();
        logger.debug("每2秒执行一次。结束。");
    }
}
